package com.colorfruit;


import com.colorfruit.framework.model.BaseUser;
import com.colorfruit.framework.model.vo.RespCode;
import com.colorfruit.framework.model.vo.RespVo;
import com.colorfruit.service.BaseUserRemoteService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * Created by xiehf on 2018/4/9.
 */
@FeignClient(name = InterfaceService.SERVICE_NAME, fallback = BaseUserService.HystrixClientFallback.class)
public interface BaseUserService extends BaseUserRemoteService {

    class HystrixClientFallback implements BaseUserService{

        @Override
        public RespVo<BaseUser> getUserByUserName(@PathVariable("userName") String userName) {
            return RespVo.error(RespCode.ERROR.getCode(), RespCode.ERROR.getMessage());
        }

        @Override
        public RespVo<BaseUser> getUserByPhone(@PathVariable("phone") String phone) {
            return RespVo.error(RespCode.ERROR.getCode(),RespCode.ERROR.getMessage());
        }
    }
}
